cd obs_pkg_rpms
git fetch --all
git reset --hard origin
obspkgrpmsdir=`pwd`
sourcedir="/srv/cache/obs/tar_scm/repo/next/"
branch=$1
if [[ "$branch" == "master" ]];then
    cd $sourcedir/openEuler
else
    cd $sourcedir/$branch
fi
pkglist=`ls`
for pkg in $pkglist
do
cd $pkg
day=`git show -s --format=%ad | awk '{print $3}'`
year=`git show -s --format=%ad | awk '{print $5}'`
month=`git show -s --format=%ad | awk '{print $2}'`
timestr=`git show -s --format=%ad | awk '{print $4}'`
if [[ "$month" == "Jan" ]];then
    month="01"
elif [[ "$month" == "Feb" ]];then
    month="02"
elif [[ "$month" == "Mar" ]];then
    month="03"
elif [[ "$month" == "Apr" ]];then
    month="04"
elif [[ "$month" == "May" ]];then
    month="05"
elif [[ "$month" == "Jun" ]];then
    month="06"
elif [[ "$month" == "Jul" ]];then
    month="07"
elif [[ "$month" == "Aug" ]];then
    month="08"
elif [[ "$month" == "Sep" ]];then
    month="09"
elif [[ "$month" == "Oct" ]];then
    month="10"
elif [[ "$month" == "Nov" ]];then
    month="11"
elif [[ "$month" == "Dec" ]];then
    month="12"
fi
if [ ${day} -lt 10 ];then
day="0${day}"
fi
datestr="${year}${month}${day} ${timestr//:/-}"
echo $datestr > ${obspkgrpmsdir}/${branch}/${pkg}
if [[ "$branch" == "master" ]];then
    cd $sourcedir/openEuler
else
    cd $sourcedir/$branch
fi
done
cd ${obspkgrpmsdir}
git pull
git add *
git commit -m "update date for package"
git push
